<!-- include tpl=usercp/head title=订单付款 -->
<div class="container-fluid no-gutters main layout-main{if !$session.user_id} main-full{/if}">
	<!-- if $session.user_id --><!-- include tpl=usercp/sidebar --><!-- /if -->
	<div class="layout-right">
		<!-- if $session.user_id --><!-- include tpl=usercp/header --><!-- /if -->
		<div class="layout-body">
			<div class="card">
				<div class="card-header">订单基本信息</div>
				<div class="card-body">
					<div class="row">
						<div class="col-4 p-1 text-right">订单编号：</div>
						<div class="col-8 p-1">{$rs.sn}</div>
					</div>
					<div class="row">
						<div class="col-4 p-1 text-right">下单时间：</div>
						<div class="col-8 p-1">{func time_format $rs.addtime}</div>
					</div>
					<!-- if $rs.email -->
					<div class="row">
						<div class="col-4 p-1 text-right">收件人邮箱：</div>
						<div class="col-8 p-1">{$rs.email}</div>
					</div>
					<!-- /if -->
					<!-- if $rs.mobile -->
					<div class="row">
						<div class="col-4 p-1 text-right">手机号：</div>
						<div class="col-8 p-1">{$rs.mobile}</div>
					</div>
					<!-- /if -->
					<!-- loop from=$rs.ext key=$key value=$value id=$tmpid -->
					<div class="row">
						<div class="col-4 p-1 text-right">{$key}：</div>
						<div class="col-8 p-1">{$value}</div>
					</div>
					<!-- /loop -->
					
					<div class="row">
						<div class="col-4 p-1 text-right">订单金额：</div>
						<div class="col-8 p-1">{func price_format $rs.price $rs.currency_id}</div>
					</div>
					<!-- if $price_paid -->
					<div class="row">
						<div class="col-4 p-1 text-right">已付款：</div>
						<div class="col-8 p-1">{func price_format $price_paid $rs.currency_id}</div>
					</div>
					<!-- /if -->
					<!-- if $price_unpaid -->
					<div class="row">
						<div class="col-4 p-1 text-right">未付款：</div>
						<div class="col-8 p-1">{func price_format $price_unpaid $rs.currency_id}</div>
					</div>
					<!-- /if -->
					<!-- if $rs.note -->
					<div class="row">
						<div class="col-4 p-1 text-right">备注：</div>
						<div class="col-8 p-1">{func nl2br $rs.note}</div>
					</div>
					<!-- /if -->
				</div>
			</div>
			<form method="post" onsubmit="return $.order.payment(this)">
			<input type="hidden" name="id" id="order-id" value="{$rs.id}" />
			<input type="hidden" name="sn" id="order-sn" value="{$rs.sn}" />
			<input type="hidden" name="passwd" id="order-passwd" value="{$rs.passwd}" />
			<!-- if $integral -->
			<div class="card mt-2">
				<div class="card-header">积分抵扣</div>
				<div class="card-body">
					<ul class="list-group list-group-flush">
						<!-- loop from=$integral key=$key value=$value -->
					    <li class="list-group-item">
						    <div class="row">
							    <div class="col-sm-8">您当前的 <span class="am-text-danger">{$value.title}</span> 有 <span class="am-text-danger">{$value.val}</span>{$value.unit}，可抵现金<span class="red">{func price_format $value.price}</span>，（100 {$value.unit}  = {$value.cash_ratio} 元）</div>
							    <div class="col-sm-4">
								    <table>
								    	<tr>
								    		<td style="width:60px;text-align:right;">支出：</td>
								    		<td><input type="text" name="integral_val[{$key}]" class="form-control" data-name="integral" data-key="{$key}" /></td>
								    		<td>&nbsp;{$value.unit}</td>
								    	</tr>
								    </table>
							    </div>
						    </div>
					    </li>
					    <!-- /loop -->
					</ul>
				</div>
			</div>
			<!-- /if -->
			<!-- if $balance -->
			<div class="card mt-2">
				<div class="card-header">余额支付</div>
				<div class="card-body">
					<!-- loop from=$balance key=$key value=$value -->
					<div class="form-check">
						<label class="form-check-label mb-2">
					    	<input type="radio" class="form-check-input" name="payment" value="{$value.identifier}" data-price="{$price_val}" data-balance="{$value.price}" />
					    	您当前的{$value.title}有<span class="red">{$value.val}</span>{$value.unit}
					    	<!-- if $price_val > $value.price -->
							，您的{$value.title}不够，请 <a href="{url ctrl=payment id=$value.id/}" target="_blank"><b>在线充值</b></a>
							<!-- /if -->
						</label>
					</div>
					<!-- /loop -->
				</div>
			</div>
			<!-- /if -->
			<!-- loop from=$paylist key=$key value=$value id=$tmpid -->
			<div class="card mt-2">
				<div class="card-header">{$value.title}</div>
				<div class="card-body">
					<!-- loop from=$value.paylist key=$k value=$v id=$idxx -->
					<div class="form-check">
						<label class="form-check-label mb-2">
					    	<input type="radio" class="form-check-input" name="payment" value="{$v.id}"{if !$tmpid.index && !$idxx.index} checked{/if} />
					    	<!-- if $v.logo1 -->
					    	<img src="{$v.logo1}" style="width:40px;"  />
					    	<!-- /if -->
					    	{$v.title}
						</label>
					</div>
					<!-- /loop -->
				</div>
			</div>
			<!-- /loop -->
			<div class="row p-4">
				<!-- if $session.user_id -->
				<div class="col">
					<a href="{url ctrl=order func=info sn=$rs.id/}" class="btn btn-link">返回订单列表</a>
				</div>
				<!-- /if -->
				<div class="col text-right">
					<input type="submit" value="确认付款" class="btn btn-primary" />
				</div>
			</div>
			</form>
		</div>
	</div>
</div>
<!-- include tpl=usercp/foot -->